package org.example.model.common;


import lombok.Data;




@Data

public class Result<T> {


    //返回码

    private Integer code;

    //返回消息

    private String message;

    //返回数据

    private T data;

    private Result() {
    }

    public static <T> Result<T> build( Integer code,String message,T data) {
        Result<T> result = new Result<T>();
        result.setCode(code);
        result.setMessage(message);
        result.setData(data);
        return result;
    }


    public static <T> Result<T> build( Integer code,String message) {
        Result<T> result = new Result<T>();
        result.setCode(code);
        result.setMessage(message);
        return result;
    }

    public static <T> Result  build (T data,ResultCodeEnum resultCodeEnum){

        return build(resultCodeEnum.getCode(),resultCodeEnum.getMessage(),data);
    }




}
